home *** CD-ROM | disk | FTP | other *** search
- ; Example sort by Sam High
- ; It's as slow as mollases on ice
- exclusive(@ON)
- array1='sam'
- array2='albert'
- array3='zoot'
- array4='polly'
- array5='frank'
- array6='doug'
- array7='lionel'
- array8='sam'
- array9='albert'
- array10='albert'
- array11='zoot'
- array12='polly'
- array13='frank'
- array14='doug'
- array15='lionel'
- ;debug(@ON)
- n=15
-
- :Isort
- k=2
- :Passit
- if k > n then goto Done
- hold=array%k%
- i=k-1
- found=@FALSE
- :Innerloop
- if !((i>=1) && (!found)) then goto IncK
- if hold < array%i% then goto NotFound
- found=@TRUE
- goto Innerloop
- :NotFound
- l=i+1
- array%l%=array%i%
- i=i-1
- goto Innerloop
- :IncK
- l=i+1
- array%l%=hold
- k=k+1
- goto Passit
-
- :Done
- i=2
- k=array1
- :GetIt
- if i > n then goto Showit
- k=strcat(k,' ',array%i%)
- i=i+1
- goto GetIt
-
- :Showit
- x=itemselect('Sorted Array',k,' ')
-
- :Names
- n=n+1
- array%n%=askline('Isort','Enter Name','')
- ; debug(@ON)
- if array%n% == '' then goto Done
- ; debug(@OFF)
- goto Names
-
- :Done
- n=n-1
- goto Isort
-